package www.openteam.com.model.business.other;


import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import www.openteam.com.OTApplication;
import www.openteam.com.base.BaseModel;
import www.openteam.com.bean.PDistrubiton_JijianNumb;
import www.openteam.com.bean.Worker;
import www.openteam.com.exception.ApiException;
import www.openteam.com.subscribe.CommonSubscriber;
import www.openteam.com.transformer.CommonTransformer;

/**
 * Created by kylin on 2017/5/2.
 */

public class PSearchModel extends BaseModel {


    private boolean isQueryP = false;



    public boolean findWorker(String code,final PSearchOnListener pSearchOnListener) {

        hzrb_httpApiService.findWorker(code).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<Worker>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        pSearchOnListener.failPInfo(e.getMessage());
                    }

                    @Override
                    public void onNext(Worker worker) {
                        pSearchOnListener.suceessPInfo(worker);
                    }
                });


        return isQueryP;
    }



    public interface PSearchOnListener {

        void suceessPInfo(Worker worker);

        void failPInfo(String error);


    }




}
